﻿@{
        var id = UrlData[0].ToLower(); 
        var ccList = CustomerManager.GetCustomerCashCards(id);
        var cols = new []{"CashCardAppNo","NameOnCard","CashCardNo","CashCardStatus","CardDelStatus","StatusDate",};
        var grid = new WebGrid(ccList,canSort:false,columnNames:cols,rowsPerPage:5,ajaxUpdateContainerId: "grid");
        
}
<script type="text/javascript">
      $(function(){
        $('th a, tfoot a').live('click', function(){
            $(this).attr('href', '#grid-anchor');
        });
    });
</script>
 <fieldset>           
 <legend>Cash Card Details</legend>
    <a name="grid-anchor"></a>
    <div id="grid">
      @functions{
                static IHtmlString ShowCCStatus(string status){
                    var s = RefDataManager.GetCashCardStatLkUpVal();
                    string cstat = string.Empty;
                    foreach(var cs in s){
                        if(cs.RefID.Equals(status)){
                            cstat=cs.RefDesc;
                        }
                    }
                    
                    return new HtmlString(cstat);
                }
                
                static IHtmlString ShowDelStatus(string del){
                    var d = RefDataManager.GetCardDelLkUpVal();
                    string cdel = string.Empty;
                    foreach(var cd in d){
                        if(cd.RefID.Equals(del)){
                            cdel=cd.RefDesc;
                        }
                    }
                    
                    return new HtmlString(cdel);
                }
                
                
           }  
      @grid.GetHtml(
               tableStyle:"webgrid",
               alternatingRowStyle:"webgrid-alternating-row",
               headerStyle:"ui-widget-header",
               fillEmptyRows:true,
               columns:grid.Columns(
                      
                      grid.Column(
                      header:"",
                      format:@<a href="#" onclick="editCC('@item.CashCardAppNo','1')">Edit</a>),
                      
                      grid.Column(
                      header:"",
                      format:@<a href="#" onclick="editCC('@item.CashCardAppNo','0')">View</a>),
                      
                      grid.Column(
                        columnName:"NameOnCard",
                        header:"Cash Card Name"
                      ),
                      grid.Column(
                         columnName:"CashCardNo",
                         header:"Cash Card Number"
                      ),
                      grid.Column(
                        columnName:"CashCardStatus",
                        header:"Cash Card Status",
                        format:@<text>@ShowCCStatus(item.CashCardStatus.ToString())</text>
                      ),
                    
                      grid.Column(
                        columnName:"CardDelStatus",
                        header:"Cash Card Delivery Status",
                         format:@<text>@ShowDelStatus(item.CardDelStatus.ToString())</text>
                      )
                    
                      
                    
                      
               
              )
               
            )
    </div>
      </fieldset>